using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class damgeable : MonoBehaviour
{
    private int x ;
    
    private void OnTriggerStay2D(Collider2D collision)
    {
        Player a = collision.GetComponent<Player>();
        if (a != null)
        {
            x = a.motionStatus;
            if(x==1)
            {
                a.GetDamage2Enemy(-a.de);
                a.ChangeHealth(-1, x);
                a.motionStatus=2;
            }
            if (x == 2)
            {
                a.GetDamage2Enemy((a.transform.position - transform.position).normalized);
                a.ChangeHealth(-1, x);
            }
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
